﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace Nirvana
{
    [Serializable]
    public struct AnimatorEvent
    {
        [SerializeField]
        [Tooltip("The event name.")]
        private string eventName;

        [Tooltip("The event integer parameter.")]
        [SerializeField]
        private string eventParam;

        public  string EventName() { return this.eventName; }
        public string EventParam() { return this.eventParam; }

        public void Excute(Animator animator,AnimatorStateInfo info)
        {
            AnimatorEventDispatcher dispatcher = animator.GetComponent<AnimatorEventDispatcher>();
            if (dispatcher != null) dispatcher.Excute(this.eventName, this.eventParam, info);
        }

    }
}

